home *** CD-ROM | disk | FTP | other *** search
- Path: noc.netcom.net!usenet
- From: Tarang Deshpande <tarang@willows.com>
- Newsgroups: comp.lang.c
- Subject: Re: ?Help - struct array of strings
- Date: Fri, 15 Mar 1996 17:00:55 -0800
- Organization: NETCOM Network Operations
- Message-ID: <314A12C7.21E0@willows.com>
- References: <4hvpgp$gu7@ftp.netgate.net>
- NNTP-Posting-Host: daffy.willows.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- Tamara Johnson wrote:
- >
- > for(i=0;i<MAX;i++)
- > {
- > printf("Enter author name (ENTER to quit); ");
- > gets(cat[i].name);
- > if(!*cat[i].name) break;
- > printf("Enter title: ");
- > gets(cat[i].title);
- > }
- > for(i=0;i<MAX;i++)
- > printf("%c %c\n", cat[i].name, cat[i].title);
-
-
-
-
- This is happening because cat[i].name is a pointer and not a character
- as you have spcified in your printf format string. If you actually
- mean to output the character then change cat[i].name to *cat[i].name.
- If on the other hand you mean to output the string then change the
- format string to "%s %s\n" instead.
-
-
- Tarang
-